package it.unibo.mumu;

import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.graphics.Color;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.TextView;

public class InfoActivity extends Activity {
	
	public static final int UNIVERSE_INFO = 0, PLANET_INFO = 1, CONTENT_INFO = 2;
	
	TextView infoText;
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_info);
		
		infoText = (TextView) findViewById(R.id.infoContent);
		infoText.setTextColor(Color.WHITE);
		
		Intent intent = getIntent();
		String t = intent.getStringExtra("TEXT");
		infoText.setText(t);
	}

	public boolean onCreateOptionsMenu(Menu menu) {
        super.onCreateOptionsMenu(menu);
        MenuItem item = menu.add(Menu.NONE, R.id.action_flip, Menu.NONE, R.string.action_back);
        item.setIcon( R.drawable.ic_action_back);
        item.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
        return true;
    }
	
	public boolean onOptionsItemSelected(MenuItem item) {
		
		if(item.getItemId() == R.id.action_flip){
			
	            finish();
	        
        }
        return super.onOptionsItemSelected(item);
    }
	
	@Override
	public void onBackPressed() { // TODO: vedere se funge e distrugge le risorse
//		Intent toHome = new Intent(InfoActivity.this,
//				StartActivity.class);
		System.gc();
		finish();
//		startActivity(toHome);
	}

}
